<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<jsp:include page="../admin.jsp"></jsp:include>
<html>
<head>
<title>网站基本信息设置</title>
<jsp:include page="../../../inc/js.jsp"></jsp:include>
<jsp:include page="../../../inc/css.jsp"></jsp:include>
<script type="text/javascript">
	$(function() {
		$("#update").button().click(function() {
			f.action="updateSite.do";
			$("#f").ajaxSubmit(function(data){
				var o = jQuery.parseJSON(data);
					if(o.success){
						clearApplication();
						alert('操作成功！');
					}
					else
						alert('操作失败！'+o.err);
			});
			
			return false;
		});
		$("#file").button().click(function() {
			$("#imgDiv").dialog( {
				title : '上传照片',
				height : 300,
				width : 630,
				modal : true
			});
			return false;
		});
		$("#cancel").button().click(function() {
			$("#imgDiv").dialog('close');
			return false;
		});
		$("#close").button().click(function() {
			window.close();
		});
		$("#upload").button().click(function() {
			$.ajaxFileUpload({
				url:'upload.do',
				secureuri:false,
				fileElementId:'inputfile',
				dataType: 'json',
				success: function (data, status){
					if(data.success){
						$("#logo").val(data.url);
						alert("上传成功！");
						$("#imgDiv").dialog('close');
					}else{
						alert('上传失败！');
					}
				}
			});
			return false;
		});
		$.get("getSelect.do", {
			type : 'YN',
			index:'${o.enabled}'
		}, function(data) {
			$("select#enabled").append(data);
		});
	});
	
</script>
</head>
<body>
<jsp:include page="functionPath.jsp">
	<jsp:param value="${url}" name="url"/>
</jsp:include>
<font color="red">${msg}</font>
<form  id="f" method="post">
<input type="hidden" id="id" name="id" value="${o.id }">
<table>

	<tr>
		<td>名称：</td>
		<td><input type="text" class="long" id="name" name="name" value="${o.name}"></td>
	</tr>
	<tr>
		<td>LOGO图片：</td>
		<td><input type="text" id="logo" name="logo" value="${o.logo}"
			class="long"> <button id="file">上传</button></td>
	</tr>
	<tr>
		<td>关键字：</td>
		<td><input type="text" id="keywords" name="keywords" value="${o.keywords}" class="long"> </td>
	</tr>
	<tr>
		<td>网站描述：</td>
		<td>
			<textarea rows="" cols="" id="description" name="description">${o.description}</textarea>
		</td>
	</tr>
	<!-- <tr>
		<td>地址：</td>
		<td><input type="text" id="address" name="address" value="${o.address}" class="long"> </td>
	</tr> -->
	<tr>
		<td>版权：</td>
		<td>
			<textarea style="width:600px;height:300px;" id="copyright" name="copyright">${o.copyright}</textarea>
			1000字符内
		</td>
	</tr>
	<tr>
		<td>启用：</td>
		<td><select id="enabled" name="enabled"></select>
		</td>
	</tr>
	<tr>
		<td colspan="2">
		<button id="update">保存</button>
		<button id="close">关闭</button>
		</td>
	</tr>
</table>
</form>
<div id="imgDiv" style="display: none;">
<form action="upload.do" id="upload_form" enctype="multipart/form-data">
<input type="file" name="file" id="inputfile" value="浏览" /><br />
<button id="upload">上传</button>
<button id="cancel">关闭</button>
</form>
</div>
</body>
</html>



